<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.org/ui">

    <ui:composition template="/template.xhtml">
        <ui:define name="title">
            <h:outputText value="#{bundle.CreateVentaTitle}"></h:outputText>
        </ui:define>
        <ui:define name="body">
            <h:panelGroup id="messagePanel" layout="block">
                <h:messages errorStyle="color: red" infoStyle="color: green" layout="table"/>
            </h:panelGroup>
            <h:form>
                <p:panelGrid columns="2">
                    <h:outputLabel value="#{bundle.CreateVentaLabel_idVenta}" for="idVenta" />
                    <h:inputText id="idVenta" value="#{ventaController.selected.idVenta}" title="#{bundle.CreateVentaTitle_idVenta}" required="true" requiredMessage="#{bundle.CreateVentaRequiredMessage_idVenta}"/>
                    <h:outputLabel value="#{bundle.CreateVentaLabel_fecha}" for="fecha" />
                    <h:inputText id="fecha" value="#{ventaController.selected.fecha}" title="#{bundle.CreateVentaTitle_fecha}" required="true" requiredMessage="#{bundle.CreateVentaRequiredMessage_fecha}">
                        <f:convertDateTime pattern="MM/dd/yyyy" />
                    </h:inputText>
                   
                    <h:outputLabel value="#{bundle.CreateVentaLabel_nrofactura}" for="nrofactura" />
                    <h:inputText id="nrofactura" value="#{ventaController.selected.nrofactura}" title="#{bundle.CreateVentaTitle_nrofactura}" required="true" requiredMessage="#{bundle.CreateVentaRequiredMessage_nrofactura}"/>
                    <h:outputLabel value="#{bundle.CreateVentaLabel_cantidad}" for="cantidad" />
                    <h:inputText id="cantidad" value="#{ventaController.selected.cantidad}" title="#{bundle.CreateVentaTitle_cantidad}" required="true" requiredMessage="#{bundle.CreateVentaRequiredMessage_cantidad}"/>
                    <h:outputLabel value="#{bundle.CreateVentaLabel_precioUnitario}" for="precioUnitario" />
                    <h:inputText id="precioUnitario" value="#{ventaController.selected.precioUnitario}" title="#{bundle.CreateVentaTitle_precioUnitario}" />
                   

                    <p:outputLabel for="idProducto" value="#{bundle.CreateVentaLabel_idProducto}"/>
                    <p:selectOneMenu id="idProducto" value="#{ventaController.selected.idProducto}" required="true" requiredMessage="#{bundle.CreateVentaRequiredMessage_idProducto}">  
                        <f:selectItem itemLabel="#{bundle.CreateProductoTitle_idProducto}" itemValue="" />  
                        <f:selectItems value="#{productoController.itemsAvailableSelectOne}" />  
                    </p:selectOneMenu> 
                    
                    
                    <p:outputLabel for="idCliente" value="#{bundle.CreateVentaLabel_idCliente}"/>
                    <p:selectOneMenu id="idCliente" value="#{ventaController.selected.idCliente}" required="true" requiredMessage="#{bundle.CreateVentaRequiredMessage_idCliente}">  
                        <f:selectItem itemLabel="#{bundle.CreateProductoTitle_idCliente}" itemValue="" />  
                        <f:selectItems value="#{clienteController.itemsAvailableSelectOne}" />  
                    </p:selectOneMenu> 
                    
                </p:panelGrid>
                <br />
                <h:commandLink action="#{ventaController.create}" value="#{bundle.CreateVentaSaveLink}" />
                <p:commandButton ajax="#{productoController.prepareList()}" value="Guardar" update="panel, dataTable" id="save"  
                                     actionListener="#{ventaController.create}" action="#{ventaController.prepareList}"/>  
                    
                <br />
                <br />
           
            </h:form>
        </ui:define>
    </ui:composition>

</html>
